/* protocol.h -- trivial remote debug protocol
**
** Copyright 2006, Brian Swetland.  All rights reserved.
** See provided LICENSE file or http://frotz.net/LICENSE for details.
*/

#ifndef __PROTOCOL__H
#define __PROTOCOL__H

typedef struct {
    unsigned char cmd;
    unsigned char tag;
    unsigned short len;
    unsigned addr;
} __attribute__ ((packed)) usb_msg;

/* common response codes */
#define MSG_OK        '0'
#define MSG_ERROR     '1'

/* basic debug interface */
#define MSG_WR_WORDS  'W'
#define MSG_RD_WORDS  'w'
#define MSG_WR_BYTES  'B'
#define MSG_RD_BYTES  'b'

#define MSG_JUMP      'G'

#define MSG_STOP      'S'
#define MSG_RESUME    's'

#define MSG_WR_REGS   'R'
#define MSG_RD_REGS   'r'


#define DEBUG_MAX_DATA    128
#define DEBUG_BRIDGE_ADDR 0x00201000
#define DEBUG_HANDSHAKE   0xaa001234

typedef struct 
{
    volatile unsigned handshake;
    volatile unsigned count;
    unsigned char data[DEBUG_MAX_DATA];
} debug_bridge;

#endif

